/*
 * @Author: cz
 * @Date: 2019-05-13 10:51
 * @Last Modified by:
 * @Last Modified time: 2019-05-13 10:51
 * @Description: 审批相关
 */

import request from '@/router/axios'
import {reviewUrls} from '@/const/apiUrl'

/**
 * 新增审批
 * @param {*} query
 */
export function addReviewRelease (query) {
  return request({
    url: reviewUrls.addReviewRelease,
    method: 'post',
    data: query
  })
}

/**
 * 新增审批发布，并提交
 * @param {*} query
 */
export function reviewSaveAndSubmit (query) {
  return request({
    url: reviewUrls.reviewSaveAndSubmit,
    method: 'post',
    data: query
  })
}

/**
 * 提交审批
 * @param {*} query
 */
export function reviewSubmit (reviewId) {
  return request({
    url: reviewUrls.reviewSubmit + reviewId,
    method: 'put'
  })
}

/**
 * 修改审批
 * @param {*} query
 */
export function reviewUpdate (reviewId,obj) {
  return request({
    url: reviewUrls.reviewUpdate + reviewId,
    method: 'put',
    data: obj
  })
}

/**
 * 修改并提交审批
 * @param {*} query
 */
export function reviewUpdateAndSubmit (reviewId,obj) {
  return request({
    url: reviewUrls.reviewUpdateAndSubmit + reviewId,
    method: 'put',
    data: obj
  })
}


/**
 * 待办审批任务
 * @param query
 */
export function toDoReviewList (query) {
  return request({
    url: reviewUrls.toDoReviewList,
    method: 'get',
    params: query
  })
}

/**
 * 审批详情
 * @param {*} query
 */
export function reviewDetail (reviewId) {
  return request({
    url: reviewUrls.reviewDetail + reviewId,
    method: 'get'
  })
}

/**
 * 审批其他附件
 * @param {*} query
 */
export function reviewFile (query) {
  return request({
    url: reviewUrls.reviewFile,
    method: 'get',
    params: query
  })
}


/**
 * 审批其他附件
 * @param {*} query
 */
export function askFile (query) {
  return request({
    url: reviewUrls.askFile,
    method: 'get',
    params: query
  })
}


/**
 * 获取参与的审批
 * @param {*} query
 */
export function reviewFinished (query) {
  return request({
    url: reviewUrls.reviewFinished,
    method: 'get',
    params: query
  })
}

/**
 * 审批图件
 * @param {*} query
 */
export function reviewImg (query) {
  return request({
    url: reviewUrls.reviewImg,
    method: 'get',
    params: query
  })
}


/**
 * 审批规划信息
 * @param {*} query
 */
export function reviewRegDetail (taskID) {
  return request({
    url: reviewUrls.reviewRegDetail + taskID,
    method: 'get'
  })
}

/**
 * 审批分页列表信息
 * @param {*} query
 */
export function reviewList (query) {
  return request({
    url: reviewUrls.reviewList,
    method: 'get',
    params:query
  })
}


/**
 * 图件预览
 * @param {*} query
 */
export function previewImg (imgId) {
  return reviewUrls.previewImg + imgId
}

/**
 * 新增专家评审意见
 * @param {*} query
 */
export function expertOpinion (query) {
  return request({
    url: reviewUrls.expertOpinion,
    method: 'post',
    data: query
  })
}


/**
 * 获取专家评审意见（最新添加的）
 * @param {*} query
 */
export function lastestOpinion (query) {
  return request({
    url: reviewUrls.lastestOpinion,
    method: 'get',
    params: query
  })
}


/**
 * 分页查询征集意见
 * @param {*} query
 */
export function opinionTarget (query) {
  return request({
    url: reviewUrls.opinionTarget,
    method: 'get',
    params: query
  })
}

/**
 * 新增征集意见
 * @param {*} query
 */
export function addOpinion (query) {
  return request({
    url: reviewUrls.addOpinion,
    method: 'post',
    data: query
  })
}

/**
 * 征集意见详情
 * @param {*} query
 */
export function reviewOpinionDetail (targetId) {
  return request({
    url: reviewUrls.reviewOpinionDetail + targetId,
    method: 'get'
  })
}

/**
 * 待反馈意见征集
 * @param {*} query
 */
export function toDoTargetOpinion (query) {
  return request({
    url: reviewUrls.toDoTargetOpinion,
    method: 'get',
    params: query
  })
}

/**
 * 征集意见反馈
 * @param {*} query
 */
export function feedBackOpinion (targetId,query) {
  return request({
    url: reviewUrls.feedBackOpinion + targetId,
    method: 'put',
    data: query
  })
}



/**
 * 市级人大审议
 * @param {*} query
 */
export function cityConpress (taskId,obj) {
  return request({
    url: reviewUrls.cityConpressUrl + taskId,
    method: 'put',
    data: obj
  })
}

/**
 * 市级政府审议
 * @param {*} query
 */
export function cityGov(taskId,obj) {
  return request({
    url: reviewUrls.cityGovUrl + taskId,
    method: 'put',
    data: obj
  })
}


/**
 * 本级人大审议
 * @param {*} query
 */
export function conpress(taskId,obj) {
  return request({
    url: reviewUrls.conpressUrl + taskId,
    method: 'put',
    data: obj
  })
}

/**
 * 部门初审
 * @param {*} query
 */
export function deptFirst(taskId,obj) {
  return request({
    url: reviewUrls.deptFirstUrl + taskId,
    method: 'put',
    data: obj
  })
}

/**
 * 本级政府审议
 * @param {*} query
 */
export function gov(taskId,obj) {
  return request({
    url: reviewUrls.govUrl + taskId,
    method: 'put',
    data: obj
  })
}

/**
 * 省级人大审议
 * @param {*} query
 */
export function provinceCongress(taskId,obj) {
  return request({
    url: reviewUrls.provinceCongressUrl + taskId,
    method: 'put',
    data: obj
  })
}

/**
 * 省级政府审议
 * @param {*} query
 */
export function provinceGov(taskId,obj) {
  return request({
    url: reviewUrls.provinceGovUrl + taskId,
    method: 'put',
    data: obj
  })
}




/**
 * 报备
 * @param {*} query
 */
export function recordReview(taskId,obj) {
  return request({
    url: reviewUrls.recordReviewUrl + taskId,
    method: 'put',
    data: obj
  })
}


/**
 * 线下流程确认
 * @param {*} query
 */
export function offlineReview(taskId,obj) {
  return request({
    url: reviewUrls.offlineReviewUrl + taskId,
    method: 'put',
    data: obj
  })
}

/**
 * 导出审核审批信息
 * @param {*}
 * @param {*}
 */
export function exportToDoReviewData (query) {
  return request({
    url: reviewUrls.exportToDoReviewData,
    method: 'get',
    responseType: 'blob',
    params: query
  })
}

/**
 * 导出审核审批信息excel
 * @param {*}
 * @param {*}
 */
export function exportToDoReviewDataExcel (query) {
  return request({
    url: reviewUrls.exportToDoReviewDataExcel,
    method: 'get',
    responseType: 'blob',
    params: query
  })
}
